package com.maochang.top.dao;


import com.maochang.top.bean.Account;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface AccountDao {

    /**
     * 保存信息
     * @param tAccount
     */
    @Insert("insert into t_account(name,money)values(#{name},#{money})")
    void save(Account tAccount);

    /**
     * 更新信息
     * @param tAccount
     */
    @Update("update t_account set name=#{name},money=#{money} where id=#{id}")
    void update(Account tAccount);

    /**
     * 删除
     * @param id
     */
    @Delete("delete from t_account where id = #{id}")
    void delete(Integer id);

    /**
     * 查询单个信息
     * @param id
     * @return
     */
    @Select("select * from t_account where id = #{id}")
    Account findById(Integer id);

    /**
     * 查找全部信息
     * @return
     */
    @Select("select * from t_account")
    List<Account> findAll();
}
